<template>
	<view class="case-list">
		<view class="case-item" v-for="(data,index) in list" :key="index" @click="goInfo(name,index)">
			<image :src="data.image" mode="aspectFill"></image>
			<view class="case-info">
				<view class="case-name">{{data[name]}}</view>
				<view class="case-brief">
					<!-- <block v-if="name==='case_name'">{{data.breif}}</block> -->
					<block>
						<text>{{data.style_name}}</text>
						<text>{{data.space}}</text>
						<text>{{data.square}}㎡</text>
					</block>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			name: {
				type: String,
				default: 'case_name'
			},
			list: {
				type: Array,
				default () {
					return []
				}
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			goInfo(name,index){
				if(name==='vr_name'){
					this.$emit('goInfo',this.list[index].vr_id)
				}else if (name==='case_name'){
					this.$emit('goInfo',this.list[index].case_id)
				}
			}
		}
	}
</script>

<style lang="scss">
	.case-list{
		padding: 0 30rpx;
		.case-item{
			margin-top: 50rpx;
			image{
				width: 100%;
				border-radius: 8rpx 8rpx 0px 0px;
				height: 550rpx;
			}
			.case-info{
				background-color: #F2F2F2;
				padding: 30rpx;
				border-radius: 0 0 8rpx 8rpx;
				text-align: center;
				.case-name{
					margin-bottom: 20rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 32rpx;
					color: #141414;
					font-weight: bold;
				}
				.case-brief{
					color: #6B6B6B;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 24rpx;
					text{
						margin: 0 10rpx;
					}
				}
			}
		}
	}
</style>
